
module hdmi_clour_bar(
  clk50m				,
  reset_n			,
  hdmi1_clk_p		,
  hdmi1_clk_n		,
  hdmi1_dat_p		,
  hdmi1_dat_n		
);

	input 			clk50m		;
	input 			reset_n		;
	output 			hdmi1_clk_p	;
	output 			hdmi1_clk_n	;
	output [2:0]	hdmi1_dat_p	;
	output [2:0]	hdmi1_dat_n	;
	
	//Resolution_1280x720   1 //时钟为74.25MHz
//	parameter DISP_WIDTH  = 1280;
//	parameter DISP_HEIGHT = 720;
	//Resolution_1920x1080   1 //时钟为148.5MHz
	parameter DISP_WIDTH  = 1920;
	parameter DISP_HEIGHT = 1080;

	wire pixelclk;
	wire pixelclk5x;
	wire pll_locked;

	wire [11:0] disp_h_addr;
	wire [11:0] disp_v_addr;
	wire disp_data_req;
	wire [23:0]disp_data;
	wire disp_hs;
	wire disp_vs;
	wire [7:0]disp_red;
	wire [7:0]disp_green;
	wire [7:0]disp_blue;
	wire disp_de;
	wire disp_pclk;


	PLL PLL_INST(
		.areset(~reset_n),
		.inclk0(clk50m),
		.c0(pixelclk),
		.c1(pixelclk5x),
		.locked(pll_locked)
	);

  colour_bar_dat_gen
  #(
    .DISP_WIDTH  ( DISP_WIDTH  ),
    .DISP_HEIGHT ( DISP_HEIGHT )
  )colour_bar_dat_gen_inst(
    .disp_h_addr   (disp_h_addr  ),
    .disp_v_addr   (disp_v_addr  ),
    .disp_data_req (disp_data_req),
    .disp_data     (disp_data    )
  );

  disp_driver disp_driver_inst(
    .ClkDisp     (pixelclk     ),
    .rst_n       (reset_n      ),
    .Data        (disp_data    ),
    .DataReq     (disp_data_req),
    .H_Addr      (disp_h_addr  ),
    .V_Addr      (disp_v_addr  ),
    .Disp_HS     (disp_hs      ),
    .Disp_VS     (disp_vs      ),
    .Disp_Red    (disp_red     ),
    .Disp_Green  (disp_green   ),
    .Disp_Blue   (disp_blue    ),
    .frame_begin (             ),
    .Disp_DE     (disp_de      ),
    .Disp_PCLK   (disp_pclk    )
  );

  dvi_encoder dvi_encoder_inst(
    .pixelclk    (pixelclk    ),
    .pixelclk5x  (pixelclk5x  ),
    .rst_p       (reset_p     ),
    .blue_din    (disp_blue   ),
    .green_din   (disp_green  ),
    .red_din     (disp_red    ),
    .hsync       (disp_hs     ),
    .vsync       (disp_vs     ),
    .de          (disp_de     ),
    .tmds_clk_p  (hdmi1_clk_p ),
    .tmds_clk_n  (hdmi1_clk_n ),
    .tmds_data_p (hdmi1_dat_p ),
    .tmds_data_n (hdmi1_dat_n )
  );


endmodule 